import { Entity, BaseEntity, PrimaryGeneratedColumn, Column, Unique, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity()
export class Admin extends BaseEntity{

  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length: '50',
    unique: true,
  })
  user: string;

  @Column({
    length: 100,
  })
  password: string;

  @Column()
  role: number;

  @Column({
    length: 50
  })
  ip: string;

  @Column({
    type: 'datetime',
    nullable: true,
    default: null,
    comment: '最后登录时间'
  })
  lastLoginTime: Date;

  @Column({
    type: 'int',
    comment: '登录次数',
    default: 0
  })
  loginCount: string;

  @CreateDateColumn()
  createdAt: string;

  @UpdateDateColumn()
  updatedAt: string;

}
